<%= form_with(model: project) do |form| %>
  <%= render "shared/error_messages", resource: form.object %>
  <div class="space-y-4">
    <%= render(FormFieldComponent.new(label: "Repository path")) do %>
      <%= form.text_field :repository_url, class: "input input-bordered w-full focus:outline-offset-0", placeholder: "accountname/repo" %>
      <div class="form-control mt-1 w-full">
        <div class="card bg-base-300 shadow-xl">
          <div class="card-body">
            <%= render "providers/provider", provider: project.project_credential_provider.provider %>
          </div>
        </div>
      </div>

    <% end %>

    <%= render(FormFieldComponent.new(label: "Predeploy command")) do %>
      <%= form.text_field :predeploy_command, class: "input input-bordered w-full focus:outline-offset-0" %>
    <% end %>
  </div>

  <div class="form-footer">
    <%= form.button "Submit", class: "btn btn-primary" %>

    <% if form.object.new_record? %>
      <%= link_to t("cancel"), projects_path, class: "btn btn-secondary" %>
    <% else %>
      <%= link_to t("cancel"), project_path(@project), class: "btn btn-secondary" %>
    <% end %>
  </div>
<% end %>
